package cn.laixueit.controller;

import cn.laixueit.pojo.Student;
import org.springframework.web.bind.annotation.*;

import java.util.Date;

//@Controller
@RequestMapping("/student")
//@ResponseBody

@RestController

public class StudentController {

    @RequestMapping("/test")
    public String test(Date date){
        System.out.println(date);
        return "test";
    }

    @RequestMapping("/test2")
    public String test2(String date){
        System.out.println(date);
        return date;
    }


    @RequestMapping("/test3")
    public Date test3(Date date){
        System.out.println(date);
        return date;
    }


    @RequestMapping("/test4")
    public Student test4(){

        Student student = new Student();
        student.setName("张三");
        student.setDate(new Date());
        return student;
    }

    @RequestMapping(value = "/testbean")
    public void testbean(Student student){
        System.out.println(student);
    }

    @GetMapping(value = {"testget","testget1","testget2"})
    public void get(){
        System.out.println("get");
    }

    @PostMapping("/testpost")
    public void post(){
        System.out.println("post");
    }

    @PostMapping("/testbody")
    public void testbody(@RequestBody String name){
        System.out.println(name);
    }

    @PostMapping("/testbodystudent")
    public void testbodystudent(@RequestBody Student student){
        System.out.println(student);
    }

    @GetMapping("/testresponsebody")
    public @ResponseBody String testbodystudent(String name){
        System.out.println(name);
        return name;
    }
}
